<template slot-scope="scope">
    <div id="idtable1" class="app-container" style="width: 99%; overflow: hidden; background: #ffffff; display: block; margin-left: 1%">
        <el-tabs type="border-card">
            <!-- 项目信息录入 -->
            <el-tab-pane>
                <span slot="label" class="tabPaneXm"><i class="el-icon-lx-home"> </i><font class="lableFont"> 项目信息录入</font></span>
                <div class="divtitle">立项阶段</div>
                <div style="height: 8px"></div>
                <!-- 立项阶段显示行 -->
                <el-input v-model="searchlx" placeholder="请输入项目名称" class="input_search"></el-input>&nbsp;&nbsp;
                <el-button type="primary" @click="search()" class="bthSearch">搜索</el-button>
                <!-- <el-button plain @click="dels()" class="btnSearchAdv">高级查询</el-button> -->
                <el-button @click="newdiaglog('newproject', '新增项目')" class="bthNormal">新增</el-button>
                <el-button @click="getList()" class="bthNormal">刷新</el-button>
                <div style="height: 8px"></div>
                <div class="app-container">
                    <el-table
                        :data="list"
                        border
                        :row-style="{ height: '30px' }"
                        :header-cell-style="{ background: '#005ab5', color: 'black' }"
                        :row-class-name="rowClassName"
                        @selection-change="handleSectionChange"
                        style="font-size: 15px; font-family: microsoft yahei; color: black"
                    >
                        <el-table-column type="selection" width="50px" align="center" header-align="center"></el-table-column>
                        <el-table-column label="序号" prop="xh" width="70px" align="center" header-align="center"></el-table-column>
                        <el-table-column
                            label="操作"
                            prop="cz"
                            width="230px"
                            align="left"
                            header-align="left"
                            style="vertical-align: bottom; text-align: left; height: 10%"
                        >
                            <template slot-scope="scope">
                                <!-- <router-link
                                    :to="{ path: '/supervision_clock/new_today_clocking', query: { id: scope.row.id } }"
                                    class="fontNormal"
                                >
                                    修改
                                </router-link> -->
                                <span style="cursor: pointer" @click="newdiaglog('xminfo', '修改',scope.row.id)" class="fontNormal">
                                    修改
                                </span>
                                <span class="fontNormal" @click="dels()">
                                    删除
                                </span>
                                <router-link
                                    :to="{ path: '/supervision_clock/new_today_clocking', query: { id: scope.row.id } }"
                                    class="fontNormal"
                                >
                                    转验收
                                </router-link>
                            </template>
                        </el-table-column>
                        <el-table-column label="项目名称" prop="proName" align="left" header-align="left">
                            <template slot-scope="scope">
                                <p style="cursor: pointer" @click="newdiaglog('xminfo', '修改', scope.row.id)" class="bthNormal">
                                    {{ scope.row.proName }}
                                </p>
                            </template>
                        </el-table-column>
                        <el-table-column label="项目位置" prop="proLocation" align="left" header-align="left"></el-table-column>
                        <el-table-column label="项目类型" prop="proType" align="left" header-align="left">
                            <template slot-scope="scope">
                                {{
                                    scope.row.proType == 1
                                        ? '旱地改水田提升'
                                        : scope.row.proType == 2
                                        ? '垦造水田'
                                        : scope.row.proType == 3
                                        ? '垦造耕地'
                                        : scope.row.proType == 4
                                        ? '建设用地复垦'
                                        : ''
                                }}
                            </template>
                        </el-table-column>
                        <el-table-column label="项目实施单位" prop="implCompany" align="left" header-align="left"></el-table-column>
                        <el-table-column
                            label="立项时间"
                            prop="projectApproval"
                            width="150px"
                            align="left"
                            header-align="left"
                        >
                        <span slot-scope="scope">{{dateFormat('YYYY-mm-dd ',scope.row.projectApproval)}}</span></el-table-column>
                    </el-table>
                </div>
                <el-pagination
                    :current-page="page"
                    :page-size="limit"
                    :total="total"
                    style="padding: 30px 0; text-align: center"
                    background
                    layout="total, prev, pager, next, jumper"
                    @current-change="getList"
                />
               

                <!-- 验收项目显示行 -->
                <div style="height: 5px"></div>
                <div class="divtitle">验收阶段</div>
                <div style="height: 8px"></div>
                <!-- 验收阶段显示行 -->
                <el-input v-model="searchlx" placeholder="请输入项目名称" class="input_search"></el-input>&nbsp;&nbsp;
                <el-button type="primary" @click="topage()" class="bthSearch">搜索</el-button>
                <!-- <el-button plain @click="dels()" class="btnSearchAdv">高级查询</el-button> -->
                <!-- <el-button @click="getList()" class="bthNormal">新增</el-button> -->
                <el-button @click="getList()" class="bthNormal">刷新</el-button>
                <div style="height: 8px"></div>
                <div class="app-container">
                    <el-table
                        :data="list"
                        border
                        :row-style="{ height: '30px' }"
                        :header-cell-style="{ background: '#005ab5', color: 'black' }"
                        :row-class-name="rowClassName"
                        @selection-change="handleSectionChange"
                        style="font-size: 15px; font-family: microsoft yahei; color: black"
                    >
                        <el-table-column type="selection" width="50px" align="center" header-align="center"></el-table-column>
                        <el-table-column label="序号" prop="xh" width="70px" align="center" header-align="center"></el-table-column>
                        <el-table-column
                            label="操作"
                            prop="cz"
                            width="230px"
                            align="left"
                            header-align="left"
                            style="vertical-align: bottom; text-align: left; height: 10%"
                        >
                            <template slot-scope="scope">
                                <router-link
                                    :to="{ path: '/supervision_clock/new_today_clocking', query: { id: scope.row.id } }"
                                    class="fontNormal"
                                >
                                    修改
                                </router-link>
                                <router-link
                                    :to="{ path: '/supervision_clock/new_today_clocking', query: { id: scope.row.id } }"
                                    class="fontNormal"
                                >
                                    删除
                                </router-link>
                                <router-link
                                    :to="{ path: '/supervision_clock/new_today_clocking', query: { id: scope.row.id } }"
                                    class="fontNormal"
                                >
                                    转验收
                                </router-link>
                            </template>
                        </el-table-column>
                        <el-table-column label="项目名称" prop="xmmc" align="left" header-align="left"></el-table-column>
                        <el-table-column label="项目位置" prop="xmwz" align="left" header-align="left"></el-table-column>
                        <el-table-column label="项目类型" prop="xmlx" align="left" header-align="left"></el-table-column>
                        <el-table-column label="项目实施单位" prop="xmssdw" align="left" header-align="left"></el-table-column>
                        <el-table-column label="立项时间" prop="lxsj" width="150px" align="left" header-align="left"></el-table-column>
                    </el-table>
                </div>
                <el-pagination
                    :current-page="page"
                    :page-size="limit"
                    :total="total"
                    style="padding: 30px 0; text-align: center"
                    background
                    layout="total, prev, pager, next, jumper"
                    @current-change="getList"
                />
            </el-tab-pane>

            <!-- 站点信息录入 -->
            <el-tab-pane>
                <span slot="label" class="tabPaneZd"><i class="el-icon-lx-home"> </i><font class="lableFont"> 站点信息录入</font></span>
                <div style="height: 8px"></div>
                <el-input v-model="searchlx" placeholder="请输入摄像头名称" class="input_search"></el-input>&nbsp;&nbsp;
                <el-button type="primary" @click="topage()" class="bthSearch">搜索</el-button>
                <!-- <el-button plain @click="dels()" class="btnSearchAdv">高级查询</el-button> -->
                <el-button @click="newdiaglog('newsit', '新增站点')" class="bthNormal">新增</el-button>
                <el-button @click="getSitList()" class="bthNormal">刷新</el-button>
                <div style="height: 8px"></div>
                <div class="app-container">
                    <el-table
                        :data="listzd"
                        border
                        :row-style="{ height: '30px' }"
                        :header-cell-style="{ background: '#005ab5', color: 'black' }"
                        :row-class-name="rowClassName"
                        @selection-change="handleSectionChange"
                        style="font-size: 15px; font-family: microsoft yahei; color: black"
                    >
                        <el-table-column type="selection" width="50px" align="center" header-align="center"></el-table-column>
                        <el-table-column label="序号" prop="xh" width="70px" align="center" header-align="center"></el-table-column>
                        <el-table-column
                            label="操作"
                            prop="cz"
                            width="100px"
                            align="left"
                            header-align="left"
                            style="vertical-align: bottom; text-align: left; height: 10%"
                        >
                            <template slot-scope="scope">
                                <span style="cursor: pointer" @click="newdiaglog('updatasit', '修改',scope.row.id)" class="fontNormal">
                                    修改
                                </span>
                                <span class="fontNormal" @click="dels()">
                                    删除
                                </span>
                            </template>
                        </el-table-column>
                        <el-table-column label="站点编号" prop="siteCode" align="left" header-align="left"></el-table-column>
                        <el-table-column label="站点名称" prop="siteName" align="left" header-align="left"></el-table-column>
                        <el-table-column label="站点坐标" prop="siteZb" align="left" header-align="left"></el-table-column>
                        <el-table-column label="站点类型" prop="siteType" align="left" header-align="left"></el-table-column>
                        <el-table-column label="所属项目" prop="proName" align="left" header-align="left"></el-table-column>
                        <el-table-column label="布置日期" prop="layoutTime" width="150px" align="left" header-align="left">
                            <span slot-scope="scope">{{dateFormat('YYYY-mm-dd ',scope.row.layoutTime)}}</span>
                        </el-table-column>
                    </el-table>
                </div>
                <el-pagination
                    :current-page="page"
                    :page-size="limit"
                    :total="Sittotal"
                    style="padding: 30px 0; text-align: center"
                    background
                    layout="total, prev, pager, next, jumper"
                    @current-change="getSitList()"
                />
            </el-tab-pane>

            <!-- 摄像头信息录入 -->
            <el-tab-pane>
                <span slot="label" class="tabPaneSxt"><i class="el-icon-lx-home"> </i><font class="lableFont"> 摄像头信息录入</font></span>
                <div style="height: 8px"></div>
                <el-input v-model="searchlx" placeholder="请输入摄像头名称" class="input_search"></el-input>&nbsp;&nbsp;
                <el-button type="primary" @click="topage()" class="bthSearch">搜索</el-button>
                <!-- <el-button plain @click="dels()" class="btnSearchAdv">高级查询</el-button> -->
                <el-button @click="newdiaglog('sxt', '新增')" class="bthNormal">新增</el-button>
                <el-button @click="getCameraList()" class="bthNormal">刷新</el-button>
                <div style="height: 8px"></div>
                <div class="app-container">
                    <el-table
                        :data="listsxt"
                        border
                        :row-style="{ height: '30px' }"
                        :header-cell-style="{ background: '#005ab5', color: 'black' }"
                        :row-class-name="rowClassName"
                        @selection-change="handleSectionChange"
                        style="font-size: 15px; font-family: microsoft yahei; color: black"
                    >
                        <el-table-column type="selection" width="50px" align="center" header-align="center"></el-table-column>
                        <el-table-column label="序号" prop="xh" width="70px" align="center" header-align="center"></el-table-column>
                        <el-table-column
                            label="操作"
                            prop="cz"
                            width="100px"
                            align="left"
                            header-align="left"
                            style="vertical-align: bottom; text-align: left; height: 10%"
                        >
                            <template slot-scope="scope">
                                <span style="cursor: pointer" @click="newdiaglog('updatacarmera', '修改',scope.row.id)" class="fontNormal">
                                    修改
                                </span>
                                <span class="fontNormal" @click="dels()">
                                    删除
                                </span>
                            </template>
                        </el-table-column>
                        <el-table-column label="摄像头编号" prop="cameraCode" align="left" header-align="left"></el-table-column>
                        <el-table-column label="摄像头名称" prop="cameraName" align="left" header-align="left"></el-table-column>
                        <el-table-column label="摄像头坐标" prop="cameraZb" align="left" header-align="left"></el-table-column>
                        <el-table-column label="摄像头类型" prop="camera_type" align="left" header-align="left"></el-table-column>
                        <el-table-column label="所属项目" prop="proBelong" align="left" header-align="left"></el-table-column>
                        <el-table-column label="布置日期" prop="setDate" width="150px" align="left" header-align="left">
                             <span slot-scope="scope">{{dateFormat('YYYY-mm-dd ',scope.row.setDate)}}</span>
                        </el-table-column>
                    </el-table>
                </div>
                <el-pagination
                    :current-page="page"
                    :page-size="limit"
                    :total="cameratotal"
                    style="padding: 30px 0; text-align: center"
                    background
                    layout="total, prev, pager, next, jumper"
                    @current-change="getCameraList()"
                />
            </el-tab-pane>
        </el-tabs>
        <el-dialog
            id="id_eldiaglog"
            :title="eldiaglog_title"
            :visible.sync="dialogVisible"
            width="80%"
            height="100%"
            :before-close="handleClose"
        >
            <div id="iddivframe">
                <iframe id="idframe" src="" frameborder="0" width="100%" height="700px"></iframe>
            </div>
            <!-- <span slot="footer" class="dialog-footer">
                <el-button @click="dialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
            </span> -->
        </el-dialog>
    </div>
</template>

<script>
var adress= " ";
import $ from 'jquery';
import project from '../../../../api/pro_source/pro_infor';
export default {

    data() {
        return {
            dialogVisible: false, //弹出框
            list: [
                
            ],
            listsxt: [
                
            ],
            listzd: [
               
            ],
            Sittotal: 0,
            cameratotal: 0,
            page: 1,
            limit: 5,
            total: 0,
            courseQuery: {},
            tableChecked: [],
            tabledatas: [],
            searchlx: '',
            eldiaglog_title: ''
        };
    },
    created() {
        setTimeout(function () {
            setPaginationFontSize();
        }, 100);
        //$('#iddivframe').html('');
        this.getList();
        this.getSitList();
        this.getCameraList();
    },
    methods: {
        //        newdocsxt(stype, stitle) {
        newdiaglog(stype, stitle,id) {
            this.dialogVisible = true;
            if ($('#idframe').attr('src') == undefined) {
                setTimeout(function () {
                    dialogFrameSrc(stype,id);
                }, 500);
            } else {
                dialogFrameSrc(stype,id);
            }
            this.eldiaglog_title = stitle;
        },
        getSitList(page = 1) {
            this.page = page;
            project.getSitInformation(this.page, this.limit).then((response) => {
                this.listzd = response.data.rows;
                this.Sittotal = response.data.total;
            });
        },
        getCameraList(page = 1) {
            this.page = page;
            project.getCameraInformation(this.page, this.limit).then((response) => {
                this.listsxt = response.data.rows;
                this.cameratotal = response.data.total;
            });
        },
        // 时间转换   
    dateFormat(fmt, date) {
    if(date != null){
      let ret="";
      date=new Date(date);
      const opt = {
        'Y+': date.getFullYear().toString(), // 年
        'm+': (date.getMonth() + 1).toString(), // 月
        'd+': date.getDate().toString(), // 日
        'H+': date.getHours().toString(), // 时
        'M+': date.getMinutes().toString(), // 分
        'S+': date.getSeconds().toString() // 秒
        // 有其他格式化字符需求可以继续添加，必须转化成字符串
      }
      for (let k in opt) {
        ret = new RegExp('(' + k + ')').exec(fmt)
        if (ret) {
          fmt = fmt.replace(
            ret[1],
            ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
          )
        }
      }
      return fmt
      }else{
          return ''
      }
    },
        rowClassName({ row, rowIndex }) {
            //row.xh = rowIndex + 1;
            row.xh = (this.page - 1) * 5 + 1 + rowIndex;
        },
        // 模糊查询
        search(){
            if(this.searchlx != ''){
            project.dimQuery(this.searchlx,this.page, this.limit).then(
                response =>{
                this.list = response.data.rows;
                this.total = response.data.total;
            })
            }else{
                this.getList()
            }
        },
        //跳转页面
        topage() {
            const { href } = this.$router.resolve({ path: '/document_form' });
            window.open(href, '_self');
        },
        //获取信息
        getList(page = 1) {
            this.page = page;
            project.getInformation(this.page, this.limit).then((response) => {
                this.list = response.data.rows;
                this.total = response.data.total;
            });
        },
        //批量删除
        dels() {
            if (this.tableChecked.length == 0) {
                alert('请选择删除的项目');
            } else {
                var _this = this;
                _this
                    .$confirm('此操作将删除记录, 是否继续?', '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    })
                    .then(() => {
                        //点击确定，执行then方法
                        //调用删除的方法
                        for (let i = 0; i < this.tableChecked.length; i++) {
                            project.deleteInformation(this.tableChecked[i].id);
                            this.getList();
                        }
                        this.badCodeSelection = [];
                    }); //点击取消，执行catch方法
            }
        },
        handleSectionChange(val) {
            this.tableChecked = val;
        },
        dialogFrameSrc11() {
            this.dialogVisible = true;
            dialogFrameSrc();
        }
    }
};
function setPaginationFontSize() {
    if ($('.el-pagination__total').css('font-size') == '13px') {
        $('.el-pagination__total').css('font-size', '15px');
        $('.el-pagination__jump').css('font-size', '15px');
    } else {
        setTimeout(function () {
            setPaginationFontSize();
        }, 100);
    }
}
function dialogFrameSrc(stype,id) {
    switch (stype) {
        case 'xminfo':
            $('#iddivframe').html(
                '<iframe id="idframe" src="' + adress +'/#/projectdetial" data-id="'+id+'" frameborder="0" width="100%" height="600px"></iframe>'
            );
            break;
        case 'sxt':
            $('#iddivframe').html(
                '<iframe id="idframe" src="' + adress +'/#/camera_input" frameborder="0" width="100%" height="600px"></iframe>'
            );
            break;
        case 'newproject':
            $('#iddivframe').html(
                '<iframe id="idframe" src="' + adress +'/#/new_lx_info" frameborder="0" width="100%" height="600px"></iframe>'
            );
            break;
        case 'newsit':
            $('#iddivframe').html(
                '<iframe id="idframe" src="' + adress +'/#/site_input" frameborder="0" width="100%" height="600px"></iframe>'
            );
            break;
        case 'updatasit':
            $('#iddivframe').html(
                '<iframe id="idframe" src="' + adress +'/#/site_input" data-id="'+id+'" frameborder="0" width="100%" height="600px"></iframe>'
            );
            break;
        case 'updatacarmera':
            $('#iddivframe').html(
                '<iframe id="idframe" src="' + adress +'/#/camera_input" data-id="'+id+'" frameborder="0" width="100%" height="600px"></iframe>'
            );
            break;
    }
    // if (stype == 'sxt') {
    //     //$('#iddivframe').html('<iframe id="idframe" src="/#/table_sxt" frameborder="0" width="100%" height="600px"></iframe>');
    //     $('#iddivframe').html('<iframe id="idframe" src="view?path=/#/table_sxt" frameborder="0" width="100%" height="600px"></iframe>');
    // } else {
    //     $('#iddivframe').html('<iframe id="idframe" src="http://www.baidu.com" frameborder="0" width="100%" height="600px"></iframe>');
    // }
}
</script>

<style>
.el-table th {
    background-color: #e2e2e2 !important;
}
.el-table .cell {
    text-overflow: clip;
}
.input_search {
    width: 150px;
}
.divtitle {
    font-family: 微软雅黑;
    font-size: 25px;
    color: #356cb3;
}
.btnSearchAdv {
    border-color: #356cb3;
    color: #356cb3;
    font-size: 15px;
    font-family: 微软雅黑;
}
.bthSearch {
    background-color: #356cb3;
    font-size: 15px;
    font-family: 微软雅黑;
}
.bthNormal {
    border-color: #848484;
    font-size: 15px;
    font-family: 微软雅黑;
}
.el-tabs--border-card {
    border: 1px solid #ffffff;
}
.lableFont {
    font-size: 15px;
    font-family: 微软雅黑;
    color: black;
}

.tabPaneXm .el-icon-lx-home {
    background-image: url('../../../../assets/img/el-tab-pane-xm.png') !important;
    background-size: 100% 99%;
}
.tabPaneXm .el-icon-lx-home::before {
    visibility: hidden;
}

.tabPaneZd .el-icon-lx-home {
    background-image: url('../../../../assets/img/el-tab-pane-zd.png') !important;
    background-size: 100% 99%;
}
.tabPaneZd .el-icon-lx-home::before {
    visibility: hidden;
}

.tabPaneSxt .el-icon-lx-home {
    background-image: url('../../../../assets/img/el-tab-pane-sxt.png') !important;
    background-size: 100% 99%;
}
.tabPaneSxt .el-icon-lx-home::before {
    visibility: hidden;
}
.fontNormal {
    color: #356cb3;
    font-size: 15px;
    font-family: 微软雅黑;
    cursor: pointer;
}
.pageNormal {
    padding: 30px 0;
    text-align: center;
    font-size: 15px;
    font-family: 微软雅黑;
    color: black;
}

.el-pagination__total {
    color: #000000;
    font-family: 微软雅黑;
}
.el-pagination__jump {
    color: #000000;
    font-family: 微软雅黑;
}
#id_eldiaglog .el-dialog__body {
    padding: 8px 8px;
}
</style>